﻿@using Ecommerce.Controllers
@using Library
@using Library.MVCHelpers
@model Library.Models.PageCulture

@{
    ViewBag.Title = Model.WebTitle;
    ViewBag.Keywords = Model.Keywords;
    ViewBag.Description = Model.WebDescription;
}
@section canonical
{
    <link rel="canonical" href="@Request.Url.Scheme://@Request.Url.Host/@Model.Url" />
}
@section hreflangs
{
    @if (ViewBag.HrefLangs != null)
    {
        var hrefLangs = ViewBag.HrefLangs.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (var hreflang in hrefLangs)
        {
            var a = hreflang.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            if (a[0] == Settings.DefaultCulture)
            {
                <link rel="alternate" href="@Request.Url.Scheme://@Request.Url.Host/@a[1]/" hreflang="x-default" />
            }
            else
            {
                <link rel="alternate" href="@Request.Url.Scheme://@Request.Url.Host/@a[0]/@a[1]" hreflang="@a[0]" />
            }
        }
    }
}
@section styles
{
    @Styles.Render("~/Content/css")
}
@section scripts
{
    @if (Model.PageId == 2)
    {
        @(HttpContext.Current.IsDebuggingEnabled ? Scripts.Render("~/bundles/contact") : Scripts.RenderFormat(@"<script src=""{0}"" async defer></script>", "~/bundles/contact"))
    }
    else
    {
        @(HttpContext.Current.IsDebuggingEnabled ? Scripts.Render("~/bundles/layout") : Scripts.RenderFormat(@"<script src=""{0}"" async defer></script>", "~/bundles/layout"))
    }
}
<article>
    <h1>@Model.WebTitle</h1>
    @Html.Raw(ViewHelper.RebuildHTMLContent(ViewHelper.ReplaceAtSignCodes(Model.Content, ViewHelper.CreateController<SharedController>())))
</article>